<?php
namespace Cyfy\Modules\Users;

class Setup extends \Cyfy\ModuleSetup
{
	static function install()
    {
        $data = array(
            'password' => Module :: hashPassword($_SESSION['userPassword']),
            'username' => $_SESSION['userUsername']
        );
            
        $ok = \dibi :: query("INSERT INTO [:cyfy:Users-users]", $data);
        
       
        $data = array(
            'gid' => 1,
            'name' => 'Administrators',
            'short' => 'A',
            'deletable' => 0
        );
        $ok = \dibi :: query("INSERT INTO [:cyfy:Users-groups]", $data);
        
        $data = array(
            'gid' => 2,
            'name' => 'Logged users',
            'short' => 'L',
            'deletable' => 0
        );
        $ok = \dibi :: query("INSERT INTO [:cyfy:Users-groups]", $data);
        
        $data = array(
            'gid' => 3,
            'name' => 'Anonymous users',
            'short' => 'AN',
            'deletable' => 0
        );
        $ok = \dibi :: query("INSERT INTO [:cyfy:Users-groups]", $data);
        
         $data = array(
            'uid' => 1,
            'gid' => 1 
        );
        $ok = \dibi :: query("INSERT INTO [:cyfy:Users-users-groups]", $data);
        
    }
}